package com.guoheng.safe.sys.controller;

import com.guoheng.safe.common.base.Result;
import com.guoheng.safe.sys.dto.IdDTO;
import com.guoheng.safe.sys.dto.basicinfo.ReservoirDataAddDTO;
import com.guoheng.safe.sys.dto.basicinfo.ReservoirDataPageDTO;
import com.guoheng.safe.sys.dto.basicinfo.ReservoirDataUpdateDTO;
import com.guoheng.safe.sys.service.ReservoirDataService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　ReservoirDataController
 *
 * @author Eternal
 * @date 2019-23-24 9:23
 */
@RestController
@Validated
@Api(value = "库区库房信息")
public class ReservoirDataController {

    @Resource
    ReservoirDataService reservoirAreaService;

    @PostMapping(value = "basic/reservoir/add")
    public Result addReservoirData(@RequestBody @Valid ReservoirDataAddDTO reservoirAreaAddDTO){
        return reservoirAreaService.addReservoirData(reservoirAreaAddDTO);
    }

    @PostMapping(value = "basic/reservoir/update")
    public Result updateReservoirData(@RequestBody @Valid ReservoirDataUpdateDTO reservoirAreaUpdateDTO){
        return reservoirAreaService.updateReservoirData(reservoirAreaUpdateDTO);
    }

    @PostMapping(value = "basic/reservoir/delete")
    public Result deleteReservoirData(@RequestBody @Valid IdDTO idDTO){
        return reservoirAreaService.deleteReservoirData(idDTO);
    }

    @PostMapping(value = "basic/reservoir/query")
    public Result getReservoirData(@RequestBody @Valid IdDTO idDTO){
        return reservoirAreaService.getReservoirData(idDTO);
    }

    @PostMapping(value = "basic/reservoir/page")
    public Result getReservoirDatas(@RequestBody @Valid ReservoirDataPageDTO pageDTO){
        return reservoirAreaService.getReservoirDataPage(pageDTO);
    }

}
